import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JFrame;

public class TestPaint {
	
	// Set up and show the window
	private static void createAndShowGUI() {

		// Create the JFrame, which will be the main layout
		JFrame frame = new JFrame("TestJFrame");
		
		// When the window is closed, exit the application
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		// Add a JPanel
		frame.add(new myPanel());
		
		// Wrap the content
		frame.pack();
		
		// Align the frame to the center
		Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
		frame.setLocation((dim.width - frame.getWidth())/2, (dim.height - frame.getHeight())/2);
		
		// Show the GUI
		frame.setVisible(true);
	}

	public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });
    }
}
